package com.fxl.majiang.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author fengxinglei
 * @date 2022/8/17 13:51
 * @description
 */
@Getter
@AllArgsConstructor
public enum SeatEnum {
    EAST(1, "东"),
    SOUTH(2, "南"),
    WEST(3, "西"),
    NORTH(4, "北");

    private int code;

    private String name;

    public static SeatEnum getPreviousSeat(SeatEnum seat) {
        if (seat == null) {
            return null;
        }
        if (SeatEnum.EAST == seat) {
            return SeatEnum.NORTH;
        } else if (SeatEnum.SOUTH == seat) {
            return SeatEnum.EAST;
        } else if (SeatEnum.WEST == seat) {
            return SeatEnum.SOUTH;
        } else {
            return SeatEnum.WEST;
        }
    }

    public static SeatEnum getNextSeat(SeatEnum seat) {
        if (seat == null) {
            return null;
        }
        if (SeatEnum.EAST == seat) {
            return SeatEnum.SOUTH;
        } else if (SeatEnum.SOUTH == seat) {
            return SeatEnum.WEST;
        } else if (SeatEnum.WEST == seat) {
            return SeatEnum.NORTH;
        } else {
            return SeatEnum.EAST;
        }
    }

    public static SeatEnum getOppositeSeat(SeatEnum seat) {
        if (seat == null) {
            return null;
        }
        if (SeatEnum.EAST == seat) {
            return SeatEnum.WEST;
        } else if (SeatEnum.SOUTH == seat) {
            return SeatEnum.NORTH;
        } else if (SeatEnum.WEST == seat) {
            return SeatEnum.EAST;
        } else {
            return SeatEnum.SOUTH;
        }
    }
}
